<template>
	<view class="progress">
		<view class="progress_number">{{number}}</view>
		<view class="progress_bar" :style="{width: `${number}%`}"></view>
	</view>
</template>

<script setup>
	defineProps({
		number: {
			type: Number,
			default: 0
		}
	})
</script>

<style lang="scss" scoped>
	.progress {
		height: 30px;
		border-radius: 5px;
		width: 100%;
		background: var(--bg);
		position: relative;
		overflow: hidden;

		&_bar {
			background: linear-gradient(to left, var(--color), var(--bg));
			background: var(--color);
			position: absolute;
			height: inherit;
			left: 0;
		}

		&_number {
			position: absolute;
			left: 50%;
			transform: translate(-50%);
			z-index: 9;
			line-height: 30px;
			color: #fff;
			mix-blend-mode: difference;

			&::after {
				content: "%";
			}
		}
	}
</style>